const app = getApp();
import { showToast } from "/utils/common";

Component({
  mixins: [],
  data: {},
  props: {
    showAdd: true,
    url: "",
    files: [],
    deleteable: true,
    onRemove: () => { }
  },
  didMount() { },
  didUpdate() { },
  didUnmount() { },
  methods: {
    onUpload() {
      if (app.globalData.systemInfo.platform === "iOS") {
        showToast({ msg: "iOS暂不支持上传附件！请至PC端上传" })
      } else {
        dd.navigateTo({
          url: `/pages/upload/upload?${this.props.url}`
        });
      }
    },
    onRemoveFile(e) {
      dd.confirm({
        title: '提示',
        content: '您确定要删除吗？',
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        success: (result) => {
          if (result.confirm) {
            this.props.onRemove(e);
          }
        },
      });
    }
  },
});